﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sortering;

namespace Sortering
{
    class Program
    {
        public static void Main()
        {
            Console.WriteLine("Hej alla de som hittat min repository. Klicka Enter för att gå vidare.");
            Console.ReadLine();
            Console.Clear();
            TestNumbers();
            Console.ReadLine();
            Console.Clear();
            TestStrings();
            Console.ReadLine();
        }
        public static void TestNumbers()
        {
            int[] numbers = { 24, 150, 1, 12309, 3900, 150, 2, 89, 1, 2, 3 };

            PrintHeading("Osorterad");
            PrintArray(numbers);

            PrintHeading("Sorterad med QuickSort()");
            Array.QuickSort(numbers);
            PrintArray(numbers);
        }
        public static void TestStrings()
        {
            string[] words = { "Erik", "Adam", "Jonny", "Råger", "Henrik", "Mats", "Åke" };

            PrintHeading("Osorterad");
            PrintArray(words);

            PrintHeading("Sorterad med QuickSort()");
            Array.QuickSort(words);
            PrintArray(words);
        }
        public static void PrintHeading(string title)
        {
            Console.WriteLine("");
            Console.WriteLine("---------------------------");
            Console.WriteLine(title);
            Console.WriteLine("---------------------------");
        }
        public static void PrintArray(int[] array)
        {
            foreach (int item in array)
            {
                Console.WriteLine(item.ToString());
            }
        }
        public static void PrintArray(string[] array)
        { 
            foreach (string item in array)
            {
                Console.WriteLine(item);
            }
        }
    }
}
